package com.cyt.wx.model.po;

import com.cyt.base.util.BaseUtil;
import com.cyt.base.util.DictCode;
import com.cyt.sys.model.po.SysUser;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.Date;

/**
 * 应用管理-应用信息实体类
 *
 * @author rong yuan
 * @date 2019-8-16 8:45:15
 */
@Data
@NoArgsConstructor
@Table(name = "cyt_wx_apply")
public class WxApply implements Serializable {

    /**
     * 主键ID
     */
    @Id
    private String id;

    /**
     * 用户id
     */
    @Column(name = "user_id")
    private String userId;

    /**
     * 应用名称
     */
    @Column(name = "name")
    private String name;

    /**
     * 应用封面
     */
    @Column(name = "cover_image")
    private String coverImage;

    /**
     * 账号id
     */
    @Column(name = "account_id")
    private String accountId;

    /**
     * 应用id
     */
    @Column(name = "apply_use_id")
    private String applyUseId;

    /**
     * 状态类型:1、正常,2、无效
     */
    @Column(name = "status")
    private String status;

    /**
     * 试用时间/天
     */
    @Column(name = "use_day")
    private Date useDay;

    /**
     * 删除标识
     */
    @Column(name = "remove_tag")
    private String removeTag;

    /**
     * 创建时间
     */
    @Column(name = "create_time")
    private Date createTime;

    /**
     * 创建人
     */
    @Column(name = "create_user")
    private String createUser;

    /**
     * 修改时间
     */
    @Column(name = "update_time")
    private Date updateTime;

    /**
     * 修改人
     */
    @Column(name = "update_user")
    private String updateUser;

    @Transient
    private String ewm;

    /**
     * 应用状态:1、默认类应用，2、购买类应用
     */
    @Transient
    private String applyUseStatus;

    /**
     * 创建对象
     *
     * @param sysUser 当前用户信息
     * @author rong yuan
     * @date 2019-8-16 8:45:15
     */
    public WxApply(SysUser sysUser) {
        this.id = BaseUtil.uId();
        this.removeTag = DictCode.BASE_REMOVE_TAG_NORMAL;
        this.createTime = new Date();
        this.createUser = sysUser.getId();
        this.updateTime = new Date();
        this.updateUser = sysUser.getId();
    }

    public WxApply(String accountId) {
        this.accountId = accountId;
    }
}